package com.hengxinguotong.zhihuichengjian.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;

import com.hengxinguotong.zhihuichengjian.R;
import com.hengxinguotong.zhihuichengjian.bean.User;
import com.hengxinguotong.zhihuichengjian.treeview.RecyclerAdapter;
import com.hengxinguotong.zhihuichengjian.widget.font.HXTextView;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * @CopyRight 恒信国通信息科技
 * @Author WuLei
 * @Date 2019/1/25
 */

public class UserSelectedAdapter extends RecyclerAdapter<User, UserSelectedAdapter.UserSelectedViewHolder> {

    public UserSelectedAdapter(Context context, List<User> dataList) {
        super(context, dataList);
    }

    @Override
    public UserSelectedViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = View.inflate(context, R.layout.item_user_selected, null);
        return new UserSelectedViewHolder(view);
    }

    @Override
    public void onBindViewHolder(UserSelectedViewHolder holder, int position) {
        holder.bindData(position);
    }

    public class UserSelectedViewHolder extends RecyclerAdapter.BaseViewHolder<User>{
        @BindView(R.id.user_name)
        HXTextView userName;

        public UserSelectedViewHolder(View itemView) {
            super(itemView);
            ButterKnife.bind(this, itemView);
        }

        @Override
        public void bindData(int position) {
            User user = dataList.get(position);
            userName.setText(user.getName());
        }
    }
}
